<?php

namespace fanletter\model;

/**
 * 
 * The Content is a topic of the newsletter. 
 * It is able to contain Elements, which are fetched by getElement. This function is forwarded to the ElementManager.
 * @author Evan
 *
 */
use fanletter\manager\ElementManager;

class Content
{
	private $id;
	private $title;
	private $teaser;
	private $order;
	private $newsletterId;
	
	public function __construct($id = 0, $title = '', $teaser = '', $order = 0, $newsletterId = 0)
	{
		$this->id = intval($id);
		$this->title = (String)$title;
		$this->teaser = (String)$teaser;
		$this->order = intval($order);
		$this->newsletterId = intval($newsletterId);
	}
	
	public function getId()
	{
		return $this->id;
	}
	
	public function getTitle()
	{
		return $this->title;
	}
	
	public function getTeaser()
	{
		return $this->teaser;
	}
	
	public function getOrder()
	{
		return $this->order;
	}
	
	public function getNewsletterId()
	{
		return $this->newsletterId;
	}
	
	/**
	 * 
	 * returns the Elements for this Content
	 * @return Array
	 * @see ElementManager::getElementsForContentId()
	 */
	public function getElements()
	{
		return ElementManager::getInstance()->getElementsForContentId($this->id);
	}
	
	public function setId($id)
	{
		$this->id = intval($id);
	}
	
	public function setTitle($title)
	{
		$this->title = (String)$title;
	}
	
	public function setTeaser($teaser)
	{
		$this->teaser = (String)$teaser;
	}
	
	public function setOrder($order)
	{
		$this->order = intval($order);
	}
	
	public function setNewsletterId($newsletterId)
	{
		$this->newsletterId = intval($newsletterId);
	}
	
}
